﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AltimilliaLibrary.LocationManagement;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using AltimilliaLibrary.Intelligence;
using AltimilliaLibrary.Utility;

namespace AltimilliaLibrary.ScreenManagement
{
    public class WorldScreen : GameScreen
    {
        LocationManager locManager;
        //32 X 48

        public WorldScreen()
        {
        }

        public override void Initialize()
        {
            locManager = new LocationManager(this);
            SpriteManager smanager = new SpriteManager(this.ScreenManager.engine.batch, new Map(new List<Terrain>(), new WalkableLayer()),this.ScreenManager.engine.Game);
            locManager.AddObject(new Location(smanager));
            this.AddManager(locManager);
            base.Initialize();

            Dictionary<String, List<Frame>> Behaviour = new Dictionary<string, List<Frame>>();
            List<Frame> Frames = new List<Frame>();
            Frames.Add(new Frame(1,0,SpriteEffects.None));
            Frames.Add(new Frame(2,0,SpriteEffects.None));
            Frames.Add(new Frame(3,0,SpriteEffects.None));
            Frames.Add(new Frame(4, 0, SpriteEffects.None));
            Behaviour.Add("WalkDown", Frames);
            List<Frame> NBextList = new List<Frame>();
            NBextList.Add(new Frame(5, 0, SpriteEffects.None));
            NBextList.Add(new Frame(6, 0, SpriteEffects.None));
            NBextList.Add(new Frame(7, 0, SpriteEffects.None));
            NBextList.Add(new Frame(8, 0, SpriteEffects.None));
            Behaviour.Add("WalkLeft", NBextList);
            List<Frame> NBextListList = new List<Frame>();
            NBextListList.Add(new Frame(9, 0, SpriteEffects.None));
            NBextListList.Add(new Frame(10, 0, SpriteEffects.None));
            NBextListList.Add(new Frame(11, 0, SpriteEffects.None));
            NBextListList.Add(new Frame(12, 0, SpriteEffects.None));
            Behaviour.Add("WalkRight", NBextListList);
            List<Frame> NListList = new List<Frame>();
            NListList.Add(new Frame(13, 0, SpriteEffects.None));
            NListList.Add(new Frame(14, 0, SpriteEffects.None));
            NListList.Add(new Frame(15, 0, SpriteEffects.None));
            NListList.Add(new Frame(16, 0, SpriteEffects.None));
            Behaviour.Add("WalkUp", NListList);

            SpriteScript script = new SpriteScript(ContentLoader.LoadUpScript());
            smanager.AddObject(new NPC(new Point(0, 0), Sprite.Facing.Forward, 15, new AnimationData(new Rectangle(0, 0, 128, 192), 32, 48, 4, 4, this.ScreenManager.engine.Game.Content.Load<Texture2D>("9985"), Behaviour),script));
        }
    }
}
